package com.hgcode.platform.util;

import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import java.util.List;

public class CollectionUtil {

    /**
     * 字符串转list
     * @param str  字符串
     * @param separator  分隔符
     * @return
     */
    public static List<String> strToList(String str,String separator){
        return Splitter.on(separator).omitEmptyStrings().splitToList(str);
    }

    /**
     * list 转字符串
     * @param list
     * @param separator 分隔符
     * @return
     */
    public static String listToStr(List<String> list,String separator){
        return Joiner.on(separator).skipNulls().join(list);
    }
}
